package com.huxi.http;

/**
 * HTTP访问异常
 * 
 * @author jian.wu
 *
 */
public class HttpCallException extends RuntimeException {

	private static final long serialVersionUID = 1L;
	private String url;
	private String requestBody;
	private String responseBody;
	private Object responseObject;

	public HttpCallException(String message) {
		super(message);
	}

	public HttpCallException(String message, Throwable cause) {
		super(message, cause);
	}

	/**
	 * HTTP访问地址
	 * 
	 * @return 访问地址
	 */
	public String getUrl() {
		return url;
	}

	public HttpCallException withUrl(String url) {
		this.url = url;
		return this;
	}

	/**
	 * HTTP访问请求内容
	 * 
	 * @return 请求内容
	 */
	public String getRequestBody() {
		return requestBody;
	}

	public HttpCallException withRequestBody(String requestBody) {
		this.requestBody = requestBody;
		return this;
	}

	/**
	 * HTTP访问响应内容
	 * 
	 * @return 响应内容
	 */
	public String getResponseBody() {
		return responseBody;
	}

	public HttpCallException withResponseBody(String responseBody) {
		this.responseBody = responseBody;
		return this;
	}

	/**
	 * HTTP访问响应内容解析后对象
	 * 
	 * @return 解析后对象
	 */
	public Object getResponseParsedObject() {
		return responseObject;
	}

	public HttpCallException withResponseParsedObject(Object responseObject) {
		this.responseObject = responseObject;
		return this;
	}

}
